package norm.reference

import grails.test.*

class UserTests extends GrailsUnitTestCase {

	def user
	
    protected void setUp() {
        super.setUp()
		user = new User(username:"kylehaw", password:"123", email:"kylehaw@gmail.com", active:1, userLevel:"admin")
    }

    protected void tearDown() {
        super.tearDown()
    }

    void testConstructor() {
		assertEquals("kylehaw", user.username)
		assertEquals("123", user.password)
		assertEquals("kylehaw@gmail.com", user.email)
		assertEquals(1, user.active)
		assertEquals("admin", user.userLevel)
    }
	
	void testToString(){	
		assertEquals("Username: kylehaw Email: kylehaw@gmail.com Active: 1 Userlevel: admin", user.toString())
	}
	
	void testVerifyPassword(){
		assertEquals(true, user.verifyPassword("123"))
		assertEquals(false, user.verifyPassword("1"))
	}
}
